package br.com.exemplo.swing;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.LineBorder;

public class ExemploJTable {

	public static void main(String[] args) {
		JFrame janela = new JFrame("Titulo da Janela");
		
		JPanel painel = new JPanel();
		janela.add(painel);

		JTable tabela = new JTable();
		
		tabela.setBorder(new LineBorder(Color.BLACK));
		tabela.setGridColor(Color.BLACK);
		tabela.setShowGrid(true);
		
		ArrayList<String> nomes = new ArrayList<String>();
		for (int i = 1; i <= 100; i++) {
			nomes.add("AAAA");
			nomes.add("BBBB");
			nomes.add("CCCC");
			nomes.add("DDDD");
			nomes.add("EEEE");
			nomes.add("FFFF");
		}
		
		tabela.setModel(new ConteudoTabela(nomes));
		
		JScrollPane scroll = new JScrollPane();
		scroll.getViewport().setBorder(null);
		scroll.getViewport().add(tabela);
		scroll.setSize(450, 450);
		painel.add(scroll);
		
		janela.setSize(500, 500);
		janela.setVisible(true);
		janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	}

}
